<template>
  <el-dialog :visible="viewVisible" width="80%" :title="dialogTitle" :before-close="closeDialog">
    <el-form :inline="true" :rules="rules" ref="form" :model="formData"
    >
      <el-row>

        <el-form-item label="处理类型" prop="cllx">

          <dict-select
              v-model="formData.cllx"
              showCode
              disabled="disabled"
              :dict-code="DictCode.FU_MANAGER_CLLX"
          ></dict-select>
        </el-form-item>
        <el-form-item label="处理状态" prop="clzt">
          <el-select v-model="formData.clzt" disabled="disabled" clearable>
            <el-option label="已处理" value="1"></el-option>
            <el-option label="未处理" value="0"></el-option>
          </el-select>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item label="操作人" prop="czr">
          <el-input v-model="formData.czr" disabled="disabled" clearable></el-input>
        </el-form-item>
        <el-form-item label="操作日期" prop="czrq">
          <el-input v-model="formData.czrq" disabled="disabled" clearable></el-input>
        </el-form-item>
      </el-row>
      <el-row>
        <el-form-item label="操作说明">
        </el-form-item>
      </el-row>
      <el-row style="width: 340px">
        <el-form-item prop="czsm">
          <!--大文本框-->
          <el-input style="width: 840px" disabled="disabled" v-model="formData.czsm" type="textarea" :rows="6"
                    placeholder="请输入内容" clearable></el-input>
        </el-form-item>
      </el-row>

      <tableList
          :showIndex="false"
          :data="listDetails"
          border
          maxHeight="100"
          :heightMin="230"
          :loading="loading"
          :keySet="keySet"
          :autoHeight="false"
          :tableData="listDetails"
          :paginationShow="false"
          :pageNumber="pages.current"
          :pageSize="pages.size"
          :total="pages.total"

          :radioSelect="true"
          @radioHandleCurrentChange="radioHandleCurrentChange"
          @handleSizeChange="handleSizeChange"
          @handleCurrentChange="handleCurrentChange"
      >
      </tableList>
      <tableList
          :showIndex="false"
          :data="listDetails1"
          border
          maxHeight="100"
          :heightMin="230"
          :loading="loading"
          :keySet="keySet"
          :autoHeight="false"
          :tableData="listDetails1"
          :paginationShow="false"
          :pageNumber="pages.current"
          :pageSize="pages.size"
          :total="pages.total"
          :radioSelect="true"
          @radioHandleCurrentChange="radioHandleCurrentChange"
          @handleSizeChange="handleSizeChange"
          @handleCurrentChange="handleCurrentChange"
      >
      </tableList>
    </el-form>
    <el-row style="margin-top: 0px">
      <div class="centered-dialog">
        <el-button type="primary" size="mini" @click="closeDialog">关闭</el-button>
      </div>
    </el-row>
  </el-dialog>
</template>

<script>
import DictSelect from "@/views/invoiceTemplate/components/DictSelect/DictSelect.vue";
import tableList from "@/components/tableList/index.vue";
import mixinTable from "@/mixin/mtable";
import SelectTreeCom from "@/components/selectTree/selectTreeCom";
import {queryForView} from "@/api/minusFlowManage";
import {DictCode} from "@/utils/DictConstant";

export default {

  data() {
    return {
      viewVisible: false,
      dialogTitle: '查看',
      listDetails: [],
      listDetails1: [],
      loading: false,
      rules: {},
      formData: {
        cllx: '',
        czsm: '',
        id: '',
        rdid: ''
      },
      keySet: [
        {
          label: '编号',
          englishName: 'rdid',
          width: '100px',
          hidden: true,
        },
        {
          label: '投保人',
          englishName: 'kfhm',
          width: '100px'
        },
        {
          label: '投保单号',
          englishName: 'tbdh',
          width: '100px'
        },
        {
          label: '业务编号',
          englishName: 'ywbh',
          width: '100px'
        },
        {
          label: '交易金额',
          englishName: 'jyrmbje',
          width: 100
        },

        {
          label: '税率',
          englishName: 'slv',
          width: 100
        },
        {
          label: '险种简称',
          englishName: 'xzjc',
          width: '100px'
        },
        {
          label: '交易日期',
          englishName: 'jyrq',
          width: '100px'
        },
        {
          label: '流水状态',
          englishName: 'lszt',
          width: '100px',
          formatter: (value) => {
            if (value == '1') {
              return '未开票'
            } else if (value == '2') {
              return '部分开票'
            } else if (value == '3') {
              return '已开票'
            } else if (value == '0') {
              return '已锁定'
            }
          }
        },
        {
          label: '保全项目代码',
          englishName: 'bqxmdm',
          width: '100px'
        },
        {
          label: '保全项目名称',
          englishName: 'bqxmmc',
          width: '100px'
        },
      ]
    };
  },
  components: {
    tableList,
    DictSelect,
    SelectTreeCom,
    DictCode
  },
  computed: {
    DictCode() {
      return DictCode
    },
  },
  mixins: [mixinTable],
  methods: {
    closeDialog() {
      this.viewVisible = false;
      this.listDetails = [];
      this.listDetails1 = []
    },
    // 查询数据
    async getInfoForview(params) {
      let {data, code, message} = await queryForView(
          params
      );
      console.log(data)
      if (code == 200) {
        this.listDetails.push(data.fuVo)
        this.listDetails1.push(data.zhengVo)
        this.formData.cllx = data.cllx
        this.formData.czsm = data.czsm
        this.formData.czrq = data.czrq
        this.formData.czr = data.czr
        this.formData.clzt = data.clzt
      }
    },
    clearInfo() {
      this.$refs.form.resetFields();
    },
    getSelectValue(val) {
      this.formData.departmentId = val.id
    },
    radioHandleCurrentChange(val) {
      this.formData.userId = val.id
    },
    handleSizeChange(val) {
      this.pages.size = val;
    },

  },
};
</script>

<style lang="scss" scoped>
@import '@/style/variables.scss';

.centered-dialog {
  display: flex;
  align-items: center;
  justify-content: center;
}


</style>